<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body{
            margin: 0;
            background-color: black;
        }
    </style>
</head>
<body>

<script src="jquery.min.js"></script>
<script>
    //开启添加雪花图片的定时器
    setInterval(function () {
        let img = $("<img src='snow.png'>");
        //得到一个20-40的随机雪花尺寸
        let size = parseInt(Math.random()*21)+20;
        img.css("width",size+"px");
        img.css("position","absolute");

        //得到窗口的宽高
        let w = $(window).width();
        let h = $(window).height();
        //得到一个随机数的left值 0-(窗口尺寸-雪花尺寸)
        let left = parseInt(Math.random()*(w-size));
        img.css("left",left+"px");

        $("body").append(img);
        //让雪花做往下移动的动画
        img.animate({"top":(h-size)+"px"},size*100).fadeOut(1000,function () {
            img.remove();//删除
        });
    },100);
</script>
</body>
</html>